<!--
 * @Descripttion: 
 * @version: 
 * @Author: Mr. Xu
 * @Date: 2020-11-24 16:26:06
 * @LastEditors: Mr. Xu
 * @LastEditTime: 2020-12-18 10:39:50
-->
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>站点配置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="robots" content="noindex,nofollow" />
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css" media="all">
  <link rel="stylesheet" href="__CSS__/common.css" media="all">
  <style>
   .layui-input,.layui-textarea{
      width: 60%;
    }
    .layui-input-block{
      width: 600px;
    }
  </style>
</head>

<body class="page-body">

  <h2 class="comm-title">站点配置</h2>
  <div class="page-main">
    <form class="layui-form new-form" id="admin">
      <div class="layui-form-item">
        <label class="layui-form-label">应用标识</label>
        <div class="layui-input-block">
          <input type="text" name="clientId" lay-verify="required" {notempty name="$list.clientId"} value="{$list.clientId}" {/notempty} placeholder="请输入应用标识" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">应用秘钥</label>
        <div class="layui-input-block">
          <input type="text" name="clientSecret" lay-verify="required" {notempty name="$list.clientSecret"} value="{$list.clientSecret}" {/notempty}  placeholder="请输入应用秘钥" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">接口地址</label>
        <div class="layui-input-block">
          <input type="text" name="jie_url" lay-verify="required" {notempty name="$list.jie_url"} value="{$list.jie_url}" {/notempty}  class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-block">
          <input type="text" name="user" lay-verify="required" {notempty name="$list.user"} value="{$list.user}" {/notempty}  class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
          <input type="text" name="password" lay-verify="required" {notempty name="$list.password"} value="{$list.password}" {/notempty}  class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">版本</label>
        <div class="layui-input-block">
          <input type="text" name="version" lay-verify="required" {notempty name="$list.version"} value="{$list.version}" {/notempty}  class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block">
          <input type="text" name="clientType" lay-verify="required" {notempty name="$list.clientType"} value="{$list.clientType}" {/notempty}  class="layui-input">
        </div>
      </div>
      
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn new-btn-style" lay-submit lay-filter="admin">立即提交</button>
        </div>
      </div>

    </form>
    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script>
        layui.use(['layer', 'form'], function() {
          var layer   = layui.layer,
              $       = layui.jquery,
              form    = layui.form;

              
              form.on('submit(admin)', function(data) {
                  $.ajax({
                      url:"{:url('site')}",
                      data:$('#admin').serialize(),
                      type:'post',
                      success:function(res) {
                          if(res.code == 0) {
                            layer.msg(res.msg, {icon: 1,time: 1500,shade: [0.5, '#000', true]}, function () {
                                window.location.reload();
                                var index = layer.getFrameIndex(window.name);
                                layer.close(index);
                            });
                          } else {
                              layer.msg(res.msg);
                          }
                      }
                  })
                  return false;
              })



        });
    </script>
  </div>
</body>

</html>